import { forwardRef, useImperativeHandle } from 'react';
import styles from './index.less';
interface PropsType {
  clickBack: (val: string) => void;
}
const emojiList = [
  { id: 1, emoji: '😀' },
  { id: 2, emoji: '😂' },
  { id: 3, emoji: '🥂' },
  { id: 4, emoji: '🤩' },
  { id: 5, emoji: '👿' },
  { id: 6, emoji: '😛' },
  { id: 7, emoji: '🤫' },
  { id: 8, emoji: '😑' },
  { id: 9, emoji: '🙄' },
  { id: 10, emoji: '🤐' },
  { id: 11, emoji: '🤑' },
  { id: 12, emoji: '🤗' },
  { id: 13, emoji: '😏' },
  { id: 14, emoji: '🥃' },
  { id: 15, emoji: '😒' },
  { id: 16, emoji: '😪' },
  { id: 17, emoji: '😴' },
  { id: 18, emoji: '🤤' },
  { id: 19, emoji: '🤧' },
  { id: 20, emoji: '🥶' },
  { id: 21, emoji: '👏🏻' },
];
const Index: React.FC<
  PropsType & {
    refInstance: any;
  }
> = (props) => {
  const { refInstance, clickBack } = props;
  useImperativeHandle(refInstance, () => ({}));
  return (
    <div className={styles.emojiWrapper}>
      {emojiList.map((item) => {
        return (
          <div className={styles.item} key={item.id} onClick={() => clickBack(item.emoji)}>
            {item.emoji}
          </div>
        );
      })}
    </div>
  );
};
export default forwardRef((props: PropsType, ref) => <Index {...props} refInstance={ref} />);
